<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>搜索结果</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui-flex.css" />
    <link rel="stylesheet" type="text/css" href="../css/index.css"/>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <style>

      .tb_zt_texttit{font-size: 0.7rem;}
      .tb_price{color:#FF175D;font-size: 0.6rem;float: left;}
      .tb_price span{text-decoration:none;color:#FF175D;font-size: 0.9rem;padding-left: 0.2rem;padding-right: 0.2rem;}

      .ta_zt{height: 1.2rem;display: flex;display: -webkit-flex;justify-content: space-between;-webkit-flex:space-between;align-items: center;-webkit-align-items: center;}
      .tb_zt_right{padding: 0.5rem 0;}

      .tb_numbar{color: #999999;font-size: 0.6rem;float: right;}
      .z_bottom{height: 1.2rem}
      .z_bottom dl{float: left;padding: 0.1rem 0.2rem;border-radius: 0.2rem;font-size:0.6rem;margin-right: 0.2rem;}
      .z_bottom dt,.z_bottom dd{float: left;}
      .z_bottom .z_l{background: #FCEAEA;color: #FF175D;}
      .z_bottom .z_r{background: #FFEFCE;color: #FFAD03}
      .z_bottom .z_r dt{border-right: 1px dashed #999999;}
    </style>
</head>
<body class="bg-white">
    <!-- 产品 -->
    <!-- 热卖 -->
    <div class="rm_bar" id="top">
        <!-- 热卖列表 -->
         <div class="rm_con">
                <div class="tb_zt_con">
                    <ul class="aui-list aui-media-list" id="list">
                      <!-- <li class="aui-list-item">
                          <div class="aui-media-list-item-inner"> <div class="aui-list-item-media"> <img class="goods_img" src="/storage/emulated/0/Android/data/com.apicloud.apploader/cache/disk/thumb/e47f5a94" _src="https://img.alicdn.com/imgextra/i2/3013499366/TB2UcHyk7CWBuNjy0FaXXXUlXXa_!!3013499366.jpg"> </div> <div class="tb_zt_right"> <div class="tb_zt_texttop"> <div class="tb_zt_text"> <div class="tb_zt_texttit aui-ellipsis-2"> 衣橱飘香袋除臭除味衣柜香包防霉防虫</div> </div> </div> <div class="ta_zt"> <div class="tb_price">¥<span>7.90</span>券后</div> <div class="tb_numbar">月销:3549&nbsp;|&nbsp;天猫</div> </div> <div class="z_bottom"> <dl class="z_l"><dt>赚</dt><dd>￥0.16</dd></dl> <dl class="z_r"><dt>券</dt><dd>￥2.00</dd></dl> </div> </div> </div>
                      </li> -->
                    </ul>
               </div>
         </div>
        <!-- 热卖列表end -->
    </div>
    <!-- 热卖 end -->
    <div class="nbsp"></div>
</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript" src="../script/aui-tab.js" ></script>
<script type="text/javascript" src="../script/zepto.min.js" ></script>
<script type="text/javascript" src="../script/doT.min.js" ></script>
<script type="text/javascript" src="../script/common.js" ></script>
<script type="text/javascript">
	var p=0,query;
    apiready = function(){
    	api.parseTapmode();
        q = api.pageParam.q||'';
        tjp = api.pageParam.tjp||'t';
        query = {q:q,tjp:tjp}
	    //滚动监听
        api.addEventListener({
            name:'scrolltobottom',
            extra:{
                threshold:100 //设置距离底部多少距离时触发，默认值为0，数字类型
            }
        }, function(ret, err){
            //_toast('已滚动到底部');
            getData(q);
        });

	    getData(q);
    };
    //搜索
    function getData(q,sort){
        console.log(JSON.stringify(q),sort)
        if (sort) {
            p = 0;
            query = q;
            location.href = '#top';
        }
        p++;
        query.p = p;
        //$('body').append('<div class="loading-1"><img src="../image/load-1.gif">加载中...</div>');
        _loading2();
        _Ajax(window.APIServer.Search,'post',{values:query},'json',function(ret){
            $('.loading-1').remove();
            _loading2_close();
            //.渲染页面
            if (ret.code==1) {
               var evalText = doT.template($api.text($api.byId('goodslist')));
               if (sort) {
                    $api.html($api.byId('list'), evalText(ret.data));
                }else{
                    $api.append($api.byId('list'), evalText(ret.data));
                }
               imageCache('.goods_img');
            }else if(ret.code==2){
               $('#list').html('<div class="loading-1">'+ret.msg+'</div>');
            }else{
                p--;
                $('body').append('<div class="loading-1">'+ret.msg+'</div>');
            }

        })
    }

</script>
<script id="goodslist" type="text/x-dot-template">
    {{ for (key in it.data){ }}
    <li class="aui-list-item" onclick='open_goods({{= JSON.stringify(it['data'][key]) }})' tapmode>
        <div class="aui-media-list-item-inner">
          <div class="aui-list-item-media">  <img class="goods_img" src="../image/faleimg.gif" _src="{{= it['data'][key]['pic'] }}"> </div>
          <div class="tb_zt_right">
            <div class="tb_zt_texttop">
              <div class="tb_zt_text">
                <div class="tb_zt_texttit aui-ellipsis-2"> {{= it['data'][key]['short_title'] }}</div>
              </div>
            </div>
            <div class="ta_zt">
              <div class="tb_price">¥<span>{{= it['data'][key]['price_after_quan'] }}</span>券后</div>
              <div class="tb_numbar">月销:{{= it['data'][key]['sales'] }}&nbsp;|&nbsp;{{? it['data'][key]['is_tmall']==0 }}淘宝{{?? it['data'][key]['is_tmall']==1 }}天猫{{?? it['data'][key]['is_tmall']==2 }}京东{{?? it['data'][key]['is_tmall']==3 }}拼多多{{?}}</div>
            </div>
            <div class="z_bottom">
              <dl class="z_l"><dt>赚</dt><dd>￥{{= it['data'][key]['earn_yg'] }}</dd></dl>
              <dl class="z_r"><dt>券</dt><dd>￥{{= it['data'][key]['quan_price'] }}</dd></dl>
            </div>
          </div>
        </div>




    </li>
    {{ } }}
</script>

</html>
